load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "fuse",
    srcs = [
        "files.go",
        "files_darwin.go",
        "files_linux.go",
        "fuse.go",
        "loopback.go",
        "loopback_darwin.go",
        "loopback_linux.go",
        "loopback_unix.go",
        "options.go",
        "util.go",
    ],
    importpath = "github.com/pachyderm/pachyderm/v2/src/server/pfs/fuse",
    visibility = ["//visibility:public"],
    deps = [
        "//src/internal/client",
        "//src/internal/errors",
        "//src/internal/errutil",
        "//src/internal/log",
        "//src/internal/pctx",
        "//src/internal/progress",
        "//src/internal/signals",
        "//src/internal/uuid",
        "//src/pfs",
        "//src/server/pfs",
        "@com_github_hanwen_go_fuse_v2//fs",
        "@com_github_hanwen_go_fuse_v2//fuse",
        "@org_golang_x_sys//unix",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "fuse_test",
    size = "large",  # test cannot be sharded because of port number conflicts
    srcs = [
        "fuse_test.go",
        "util_test.go",
    ],
    embed = [":fuse"],
    pure = "on",
    tags = [
        "manual",
        "no-sandbox",
    ],  # fusermount cannot run in bazel test sandbox or docker
    deps = [
        "//src/internal/client",
        "//src/internal/errors",
        "//src/internal/pachd",
        "//src/internal/require",
        "//src/internal/testutil/random",
        "//src/pfs",
        "//src/server/pfs",
        "@com_github_hanwen_go_fuse_v2//fs",
        "@com_github_hanwen_go_fuse_v2//fuse",
    ],
)
